package file

import com.xdja.jwt.imagecollect.app.bean.NetTrunkUploadBean
import com.xdja.jwt.imagecollect.app.bean.TrunkUploadBean
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.http.*


/**
 * @author yuanwanli
 * @des  文件上传下载相关的接口
 * @date 2019/4/17
 */
interface FilesApi {
    @POST("/pcs/lifemobile/file/uploadFileToFastDfs") //对接fastdfs,分片上传(生活域)
    suspend fun uploadNetFile(
        @Body body: RequestBody, @Header("fileid") fileid: String = "",
        @Header("filename") fileName: String, @Header("filesize") fileSize: Long
    ): NetTrunkUploadBean

    @POST("") //对接fastdfs,分片上传
    suspend fun uploadFile(
        @Url url: String, @Body body: RequestBody, @Header("fileid") fileid: String? = null, @Header(
            "perm"
        ) perm: String = "1",
        @Header("filename") fileName: String, @Header("filesize") fileSize: Long
    ): TrunkUploadBean

    @Streaming
    @GET  //对接fastdfs,断点下载
    suspend fun downloadPartial(@Url url: String, @Header("Range") range: String): ResponseBody
}